package com.autumn.mybatis.criterion.impl;

import java.util.ArrayList;
import java.util.List;

import com.autumn.mybatis.criterion.ICriteriaSection;
import com.autumn.mybatis.criterion.LockModeEnum;
import com.autumn.mybatis.criterion.clauses.AbstractCriteriaClause;

/**
 * 条件段
 * 
 * @author 老码农
 *
 *         2017-10-26 19:20:12
 */
public class CriteriaSectionImpl implements ICriteriaSection {
	private final List<AbstractCriteriaClause> criterias;

	private final LockModeEnum lockMode;

	/**
	 * 
	 * @param lockMode
	 */
	public CriteriaSectionImpl(LockModeEnum lockMode) {
		this.criterias = new ArrayList<>();
		if (lockMode != null) {
			this.lockMode = lockMode;
		} else {
			this.lockMode = LockModeEnum.NONE;
		}
	}

	/**
	 * 获取锁模式
	 * 
	 * @return
	 */
	@Override
	public LockModeEnum getLockMode() {
		return this.lockMode;
	}

	@Override
	public final List<AbstractCriteriaClause> getCriterias() {
		return this.criterias;
	}

}
